module TestQueues where

import qualified Queue.ListQueue as L
import qualified Queue.SimpleQueue as S
import qualified Queue.SimpleQueueLen as SL
import qualified Queue.SchedQueue as SQ
import qualified Queue.Deque as DQ

testL n = L.isEmpty (drop q)
  where
    q = foldl L.add L.empty [1..n]
    drop q = if L.isEmpty q then q else drop (L.tail q)

testS n = S.isEmpty (drop q)
  where
    q = foldl S.add S.empty [1..n]
    drop q = if S.isEmpty q then q else drop (S.tail q)

testSL n = SL.isEmpty (drop q)
  where
    q = foldl SL.add SL.empty [1..n]
    drop q = if SL.isEmpty q then q else drop (SL.tail q)

testSQ n = SQ.isEmpty (drop q)
  where
    q = foldl SQ.add SQ.empty [1..n]
    drop q = if SQ.isEmpty q then q else drop (SQ.tail q)

-- Deque
testAddFrontTakeLast =
        DQ.last(DQ.addFront DQ.empty 5)
        
testAddEndTakeHead =
        DQ.head(DQ.addEnd DQ.empty 5)      
        
testErrorInitOnEmpty1 =
        DQ.init(DQ.init(DQ.addEnd DQ.empty 5))      
        
testErrorInitOnEmpty2 =
        DQ.init(DQ.init(DQ.addFront DQ.empty 5))  
        
testErrorTailOnEmpty1 =
        DQ.init(DQ.tail(DQ.addEnd DQ.empty 5))      
        
testErrorTailOnEmpty2 =
        DQ.tail(DQ.init(DQ.addFront DQ.empty 5)) 
        
testBalanceTreeFourElementsOnFront =
        DQ.addFront(DQ.addFront(DQ.addFront(DQ.addFront DQ.empty 1) 2) 3) 4

testBalanceTreeFiveElementsOnFront =
        DQ.addFront(DQ.addFront(DQ.addFront(DQ.addFront(DQ.addFront DQ.empty 1) 2) 3) 4) 5